
package com.bash.carrep.dao.enties;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author bash
 */
@Entity
@Table(name = "modeleauto", catalog = "carrepdb", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "ModeleAuto.findAll", query = "SELECT m FROM ModeleAuto m"),
    @NamedQuery(name = "ModeleAuto.findByIdModeleAuto", query = "SELECT m FROM ModeleAuto m WHERE m.idModeleAuto = :idModeleAuto"),
    @NamedQuery(name = "ModeleAuto.findByMarque", query = "SELECT m FROM ModeleAuto m WHERE m.marque = :marque"),
    @NamedQuery(name = "ModeleAuto.findByModele", query = "SELECT m FROM ModeleAuto m WHERE m.modele = :modele"),
    @NamedQuery(name = "ModeleAuto.findBySerie", query = "SELECT m FROM ModeleAuto m WHERE m.serie = :serie"),
    @NamedQuery(name = "ModeleAuto.findByPuissance", query = "SELECT m FROM ModeleAuto m WHERE m.puissance = :puissance")})
public class ModeleAuto implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "idModeleAuto", nullable = false)
    private Integer idModeleAuto;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "Marque", nullable = false, length = 45)
    private String marque;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "Modele", nullable = false, length = 45)
    private String modele;
    @Size(max = 15)
    @Column(name = "serie", length = 15)
    private String serie;
    @Basic(optional = false)
    @NotNull
    @Column(name = "Puissance", nullable = false)
    private double puissance;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idModele")
    private List<Automobile> automobileList;

    public ModeleAuto() {
    }

    public ModeleAuto(Integer idModeleAuto) {
        this.idModeleAuto = idModeleAuto;
    }

    public ModeleAuto(Integer idModeleAuto, String marque, String modele, double puissance) {
        this.idModeleAuto = idModeleAuto;
        this.marque = marque;
        this.modele = modele;
        this.puissance = puissance;
    }

    public Integer getIdModeleAuto() {
        return idModeleAuto;
    }

    public void setIdModeleAuto(Integer idModeleAuto) {
        this.idModeleAuto = idModeleAuto;
    }

    public String getMarque() {
        return marque;
    }

    public void setMarque(String marque) {
        this.marque = marque;
    }

    public String getModele() {
        return modele;
    }

    public void setModele(String modele) {
        this.modele = modele;
    }

    public String getSerie() {
        return serie;
    }

    public void setSerie(String serie) {
        this.serie = serie;
    }

    public double getPuissance() {
        return puissance;
    }

    public void setPuissance(double puissance) {
        this.puissance = puissance;
    }

    @XmlTransient
    public List<Automobile> getAutomobileList() {
        return automobileList;
    }

    public void setAutomobileList(List<Automobile> automobileList) {
        this.automobileList = automobileList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idModeleAuto != null ? idModeleAuto.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ModeleAuto)) {
            return false;
        }
        ModeleAuto other = (ModeleAuto) object;
        if ((this.idModeleAuto == null && other.idModeleAuto != null) || (this.idModeleAuto != null && !this.idModeleAuto.equals(other.idModeleAuto))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.bash.carrep.dao.enties.ModeleAuto[ idModeleAuto=" + idModeleAuto + " ]";
    }
    
}
